Adding a Folder to the Default Website
To add a folder to the Windows 7 default website, you have two choices:
The next two sections provide you with the details.
Adding a Folder Manually
Adding a folder to
the Windows 7 default website is not all that different from adding a
file. That is, you can create a new subfolder within the wwwroot folder, or copy or move an existing folder and paste it within wwwroot.
To access web content within the new folder, tack the folder name and
filename to the default website address. For example, if you create a
subfolder named photos within the wwwroot folder, and the main page is named photos.htm, you access the content by entering the following address into the browser:
http://localhost/photos/photos.htm
Note that you can save
some wear and tear on your typing fingers by changing the name of the
main content file to one of the following:
default.htm
default.asp
index.htm
index.html
default.aspx
When you use one of
these names, IIS displays the file by default if you don’t specify a
filename as part of the URL. For example, if you rename the photos.htm file to default.htm, you can access the file just by specifying the folder path in the URL:
Adding a Folder as a New Virtual Directory
When you add a folder
manually, IIS Manager detects the new folder and adds it to the folder
content. (If you don’t see the folder right away, switch to Content
View, right-click Default Web Site, and then click Refresh.) However,
you can also use IIS Manager to create a new folder within the default
website. Here are the steps to follow:
1. | In IIS Manager, open the Computer, Sites, Default Web Site branch (where Computer is the name of your Windows 7 PC).
|
2. | Right-click Default Web Site, and then click Add Virtual Directory. IIS Manager displays the Add Virtual Directory dialog box. Figure 6 shows a completed version of the dialog box.
|
3. | Use
the Alias text box to enter an alias for the virtual directory. The
alias is the name that will appear in IIS Manager as a sub-branch of the
default website.
Note
The alias doesn’t have to be the same as the name of the virtual directory itself. For example, if you give the name photos to the new virtual directory, you could use something like Photos Virtual Directory as the alias.
|
4. | To specify the location of the virtual directory, you have three choices:
If the folder exists and you know the full pathname (drive and folders), type it in the Physical Path text box. If
the folder exists and you’re not sure of the full pathname (or it’s too
long to type), click the Browse (...) button, use the Browse for Folder
dialog box to select the folder, and then click OK. If
the folder doesn’t exist, click Browse (...), use the Browse for Folder
dialog box to select the folder within which you want the new folder to
appear (for example, wwwroot), click Make New Folder, type the folder name, press Enter, and then click OK.
|
5. | Click OK.
|
Figure 7 shows the Default Web Site in IIS Manager with the new virtual directory added.